-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cling] Make cling::utils::Lookup::Named look into using directives #15458
Conversation
interpreter/cling/lib/Utils/AST.cpp
Outdated
if (!res && primaryWithin->isNamespace()) | ||
for (auto* UD : primaryWithin->using_directives()) | ||
if (NamespaceDecl* NS = UD->getNominatedNamespace()) | ||
res = S->LookupQualifiedName(R, NS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sema has an interface Sema::LookupName
that follows the language rules. Can we use that one? We need to create some scope which describes the lookup position but I guess most of the time we care about the TUScope...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sema::LookupName
is already used (since the inception of this function) on line 1492 for the TUScope
. I suspect we did not know (do we know now?) how to create "some scope which describes the lookup position".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect we can push a scope with the namespace we want to look from, but we need to be careful to rebuild the scope nesting going from that namespace towards TU.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's the best solution, I realized that clang doesn't look into namespaces unless the RedeclarationKind
is set to Sema::NotForRedeclaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent of my comment was to avoid duplication of code that already exists in clang. The new version of that patch seems to address it.
Is there a corresponding roottest PR enabling/adding test for this? |
Test Results 14 files 14 suites 3d 10h 44m 0s ⏱️ Results for commit ca410ed. ♻️ This comment has been updated with latest results. |
Added a cling test for this. |
3267681
to
f938114
Compare
863ffc9
to
ca410ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@devajithvs can you try enabling the test in |
Check running here: #16535 corresponding to root-project/roottest#1194 |
This Pull request:
Changes or fixes:
Checklist:
This PR fixes #15407